<template>
  <template v-for="menu in userMenu"> 
    <el-sub-menu 
    :index="menu.path" 
    v-if="menu.children&& menu.children.length>0 &&
        menu.children[0].menuType == 1"
        :key="menu._id">
          <template #title>
            <el-icon><Menu /></el-icon>
            <span>{{ menu.menuName }}</span>
          </template>
            <tree-menu :userMenu="menu.children" ></tree-menu>           
    </el-sub-menu>
    <el-menu-item
    v-else-if="menu.menuType==1" :index="menu.path">{{ menu.menuName }}</el-menu-item>

  </template>
</template>

<script >
export default{
    name:'TreeMenu',
    props:{
        userMenu:{
            type:Array,
            default(){
                return [];
            }
        }
    }
}

</script>

<style scoped lang="scss"

</style>